cmake_minimum_required(VERSION 3.12)
project(nn)

file(GLOB ${PROJECT_NAME}_SOURCES
    "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)

add_library(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_SOURCES})

target_link_libraries(${PROJECT_NAME} PUBLIC
    ${OpenCV_LIBS}
    spdlog::spdlog
    vision
    component
    nvinfer
    nvonnxparser
    cudart
    cudnn
    myplugins
)

if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
    target_include_directories(${PROJECT_NAME} PUBLIC
        /usr/local/cuda/targets/aarch64-linux/include
        /usr/local/cuda/include
        /usr/src/tensorrt/samples/common
    )
    target_link_directories(${PROJECT_NAME} PUBLIC /usr/local/cuda/targets/aarch64-linux/lib)
    target_link_directories(${PROJECT_NAME} PUBLIC /usr/src/tensorrt/lib)
else()
    target_include_directories(${PROJECT_NAME}
        PUBLIC /usr/local/cuda/include
        PUBLIC /usr/src/tensorrt/samples/common
    )
    target_link_directories(${PROJECT_NAME} PUBLIC /usr/local/cuda/lib64)
endif()

target_include_directories(${PROJECT_NAME} PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../vision/
    ${CMAKE_CURRENT_SOURCE_DIR}/../component/
    ${CMAKE_CURRENT_SOURCE_DIR}/../cuda/
)

add_dependencies(${PROJECT_NAME}
    component
)